package com.tutu.commons.pojo;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.tutu.commons.checks.RemoveCartCheck;
import com.tutu.commons.checks.SaveCartCheck;
import com.tutu.commons.checks.UpdateCartCheck;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

/**
 * @Program: b2c-cloud-store
 * @Description: 购物车实体类
 * @Author: JK.TuTu
 * @ @Version: 1.0
 * @Create: 2022-12-23 09:14
 **/
@Data
public class Cart implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(type = IdType.AUTO)
    private Integer id;

    @NotNull(message = "用户ID不能为空", groups = {SaveCartCheck.class, UpdateCartCheck.class, RemoveCartCheck.class})
    @TableField("user_id")
    private Integer userId;

    @NotNull(message = "商品ID不能为空", groups = {SaveCartCheck.class, UpdateCartCheck.class, RemoveCartCheck.class})
    @TableField("product_id")
    private Integer productId;

    @NotNull(message = "修改后的商品数量不可为空", groups = UpdateCartCheck.class)
    @TableField("num")
    private Integer num;

}
